<template>
  <div class="fenlei">
    <ul>
      <li v-for="item in list" @click="fenleidetail(item.name)">
        {{ item.name }}
      </li>
    </ul>
  </div>
</template>

<script>
import { reqfenlei } from "@/api/fenlei";
import { reqfenleidetail } from "@/api/fenlei";
export default {
  data() {
    return {
      list: [],
      detail: [],
    };
  },
  computed: {},
  watch: {},

  methods: {
    //获取分类数据
    async Fenlei() {
      let params = {
        per: 10,
        page: 1,
      };
      const result = await reqfenlei({ page: 1 });
      console.log(result);
      this.list = result.categories;
    },
    //获取分类列表
    async fenleidetail(a) {
      const result = await reqfenleidetail(a);
      console.log(result);
      // this.detail = result;
    },
  },
  created() {
    this.Fenlei();
    this.fenleidetail();
    // reqfenleidetail(this.da).then((res) => {
    //   console.log(res);
    // });
  },
  mounted() {},
  components: {},
};
</script>
<style scoped></style>
